#include <iostream>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <memory.h>
#include <stdio.h>

using namespace std;

int main()
{
    int sfd = socket(AF_INET, SOCK_STREAM, 0);
    if(sfd < 0)
        return -1;

    struct sockaddr_in addr;
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = inet_addr("114.132.246.245");
    addr.sin_port = htons(8888);
    connect(sfd, (struct sockaddr*)&addr, sizeof(addr));
    char buf[1024] = {0};
    int k = 5;
    while(k--){
        cin>>buf;
        send(sfd, buf, strlen(buf), 0);
        memset(buf, '\0', sizeof(buf));
        printf("server : %s\n", buf);
    }
    close(sfd);
    return 0;
}
